//**************************************************************************************************
//  While.java     Author:Duanzhixuan
//
//   Use the while staement to caculate the n!.
//*******************************************************************************************************
import java.util.Scanner;

public class While
{
public static void main(String[] args)
{ 
int sum=1;
Scanner generator =new Scanner(System.in);
System.out.println("Please enter a positive int number or zero:");
int number = generator.nextInt();
int num = number;
if (number==0)
System.out.println("阶乘为：1");//人为定义0的阶乘为1。
else
{while(num>0)
{ sum*=num;
  num--;
}
System.out.println("阶乘为："+sum);}
}
}

